﻿using System;
using System.Net;

namespace nRoute.Components.Composition
{
    public class PerInstanceLifetimeManager
        : ILifetimeManager
    {

#region ILifetimeManager

        public Object ManageBuild(ITypeBuilder typeBuilder, Func<ITypeBuilder, Object> resourceBuilder)
        {
            return resourceBuilder(typeBuilder);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

#endregion

#region IDisposable Members

        protected virtual void Dispose(bool disposing) 
        {
           // do nothing, since we store nothing
        }

#endregion

        ~PerInstanceLifetimeManager() { Dispose(false); }

    }
}
